import os

from dotenv import load_dotenv

load_dotenv()


class MysqlConfig:
    SQLALCHEMY_DATABASE_URI = os.getenv("SQLALCHEMY_DATABASE_URI") or ''
    SQLALCHEMY_TRACK_MODIFICATIONS = os.getenv('SQLALCHEMY_TRACK_MODIFICATIONS').lower() == "true" if os.environ.get('SQLALCHEMY_TRACK_MODIFICATIONS') is not None else False
    SQLALCHEMY_ECHO = os.getenv('SQLALCHEMY_ECHO').lower() == "true" if os.environ.get('SQLALCHEMY_ECHO') is not None else False
    
    # 连接池配置
    SQLALCHEMY_ENGINE_OPTIONS = {
        'pool_size': 10,
        'pool_recycle': 120,
        'pool_pre_ping': True,
        'max_overflow': 20
    }
